See Also

Tcp Class  | Tcp Members  | Overload List

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

Language

Visual Basic

C#

C++

C++/CLI

Show All

prompts
Data is read until one of the strings in the array is found.
See Also Languages PowerTCP Email Validation for .NET

WaitFor(String[]) Method

Dart.PowerTCP.EmailValidation Namespace > Tcp Class > WaitFor Method : WaitFor(String[]) Method

Reads data from the stream until the specified string is found.

[Visual Basic]
Overloads Public Function WaitFor( _    ByVal prompts() As String _ ) As String
[C#]
public string WaitFor(    string[] prompts );
[C++]
public: string* WaitFor(    string*[]* prompts )
[C++/CLI]
public: String^ WaitFor(    String^array<prompts>^ prompts )

Parameters

prompts
Data is read until one of the strings in the array is found.

Return Type

A string containing all data read from the stream.

Exceptions

ExceptionDescription
SocketExceptionprompt was not found within the specified period of time.
InvalidOperationExceptionTcp.ReceiveTimeout is 0.

Remarks

This method reads from the data stream until one of the specified strings are found or the method times out. Often, it is useful when communicating with a server to be able to read data until one of several tokens is found. For example, during the login operation the server may send a string "login:". You could use the WaitFor method to keep reading until you find "login:", then issue your login command.

This method will block for the amount of time specified in Tcp.ReceiveTimeout. If Tcp.ReceiveTimeout is 0, this method will throw a System.InvalidOperationException. If prompt is not found within the time specified by Tcp.ReceiveTimeout, a System.SocketException is thrown (with the timeout ErrorCode of 10060).

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP, Windows Server 2003, Windows Vista

See Also

Tcp Class  | Tcp Members  | Overload List


Send comments on this topic.

Documentation version 1.0.3.0.

© 2008 Dart Communications.  All rights reserved.